
package com.jf.cloud.supplier.controller.supplier;


import com.jf.cloud.common.response.ServerResponseEntity;
import com.jf.cloud.common.security.AuthUserContext;
import com.jf.cloud.supplier.dto.SupplierWithdrawCashDTO;
import com.jf.cloud.supplier.service.SupplierWithdrawCashService;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import ma.glasnost.orika.MapperFacade;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 提现申请信息
 *
 * @author zz
 * @date 2021-06-10 10:28:13
 */
@RestController("supplierSupplierWithdrawCashController")
@RequestMapping("/s/supplier_withdraw_cash")
@Tag(name = "supplier-提现申请信息")
public class SupplierWithdrawCashController {

    @Autowired
    private SupplierWithdrawCashService supplierWithdrawCashService;
    @Autowired
    private MapperFacade mapperFacade;

    @PostMapping("/apply")
    @Operation(summary = "供应商提交申请提现" , description = "供应商提交申请提现")
    public ServerResponseEntity<Void> apply(@RequestBody SupplierWithdrawCashDTO supplierWithdrawCashDTO) {
        supplierWithdrawCashService.apply(supplierWithdrawCashDTO, AuthUserContext.get().getTenantId());
        return ServerResponseEntity.success();
    }

    @GetMapping("/check_draw_cash_amount")
    @Operation(summary = "检查提现金额", description = "")
    public ServerResponseEntity<Boolean> checkDrawCashAmount(Long amount) {
        supplierWithdrawCashService.checkDrawCashAmount(amount);
        return ServerResponseEntity.success(true);
    }

//    @GetMapping("/page")
//    @Operation(summary = "获取供应商提现记录信息" , description = "获取供应商提现记录信息")
//    public ServerResponseEntity<PageVO<SupplierWithdrawCashVO>> page(PageDTO pageDTO, SupplierWithdrawCashDTO supplierWithdrawCashDTO) {
//        supplierWithdrawCashDTO.setSupplierId(AuthUserContext.get().getTenantId());
//        PageVO<SupplierWithdrawCashVO> pageVO = supplierWithdrawCashService.pageByParam(pageDTO, supplierWithdrawCashDTO);
//        return ServerResponseEntity.success(pageVO);
//    }


}
